import 'package:cat_eye/config/color_config.dart';
import 'package:cat_eye/config/string_config.dart';
import 'package:cat_eye/util/loading_state_widget_util.dart';
import 'package:cat_eye/util/util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';

/*
* @Package: web_view
* @ClassName: WebViewWidget
* @Author: szj
* @CreateDate: 8/4/21 7:44 PM
* TODO WebView页面
*/
class WebViewWidget extends StatefulWidget {
  final String url;

  const WebViewWidget({Key key, @required this.url}) : super(key: key);

  @override
  _WebViewWidgetState createState() => _WebViewWidgetState();
}

class _WebViewWidgetState extends State<WebViewWidget> {
  @override
  Widget build(BuildContext context) {
    return WebviewScaffold(
        appBar: appBar(StringConfig.INFORMATION_DETAILS,backgroundColor: ColorConfig.themeColor),

        ///是否缩放
        withZoom: true,
        //是否缓存
        withLocalStorage: true,
        //默认状态
        hidden: true,
        //这三个参数解决的是在android端网页自动放大问题
        useWideViewPort: true,
        displayZoomControls: true,
        withOverviewMode: true,

        //未加载出WebView时展示
        initialChild: Center(
          child: CupertinoActivityIndicator(
            radius: 30,
            animating: true,
          ),
        ),
        url: widget.url);
  }
}
